<template>
	<div>
		<!-- 头部搜索 -->
		<div class="top">
			<div class="top-left" @click="goBack">
				<img class="top-back-img" src="../assets/images/back.png" />
				<span class="top-back-text">返回</span>
			</div>
			<div class="top-center">
				<van-search
					class="top-search-input"
					v-model="value"
					shape="round"
					background="#ed414a"
					placeholder="请输入搜索关键词"
				/>
			</div>
			<div class="top-right">
				<img class="top-search-img" src="../assets/images/search.png" />
			</div>
		</div>
		<div class="Fl_list">
			<div class="Fl_listnow">
				<span>工作</span>
			</div>
			<div class="Fl_swiper">
				<swiper ref="mySwiper" :options="swiperOptions">
					<swiper-slide>教育</swiper-slide>
					<swiper-slide>房屋</swiper-slide>
					<swiper-slide>生活</swiper-slide>
					<swiper-slide>闲置</swiper-slide>
					<swiper-slide>装修</swiper-slide>
          <swiper-slide>车辆</swiper-slide>
					<swiper-slide>宠物</swiper-slide>
					<swiper-slide>宣传</swiper-slide>
					<swiper-slide>帮助</swiper-slide>
				</swiper>
			</div>
		</div>
		<div style="height:1px; width:100%; background-color:#f2f2f2"></div>
		<!-- 下面列表部分 -->
		<div @click="openDetail">
			<home-item></home-item>
		</div>
	</div>
</template>
<script>
import HomeItem from "@/views/HomeItem.vue";

export default {
	components: { HomeItem },
  data() {
    return  {
      value: "",
      swiperOptions: {
        loop: true,
        autoplay: {
          delay: 3000,
          stopOnLastSlide: false,
          disableOnInteraction: false,
        },
        slidesPerView: 4,//显示个数
        observeParents: true,
        observer: true
      },
    }
  },
	methods: {
		goBack () {
			this.$router.go(-1)
		},
		openDetail () {
			this.$router.push({
				name: "Detail",
			});
		},
	},
	computed: {
		swiper () {
			return this.$refs.mySwiper.swiper
		}
	},
	mounted () {
		// this.swiper.slideTo(3, 1000, true)
	}
};
</script>

<style scoped>
.top {
	width: 100%;
	background-color: rgb(237, 65, 74);
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
}
.top-left {
	display: flex;
	flex-direction: row;
	align-items: center;
	width: 20%;
}
.top-back-img {
	width: 30px;
	height: 25px;
}
.top-back-text {
	color: white;
	font-size: 16px;
}
.top-center {
	width: 60%;
}
.top-search {
	width: 20%;
}
.top-search-img {
	width: 25px;
	height: 25px;
	margin-right: 15px;
}
.Fl_list {
	height: 50px;
	width: 100%;
	display: flex;
	flex-direction: row;
}
.Fl_listnow {
	height: 50px;
	line-height: 50px;
	text-align: center;
	color: #ed414a;
	font-size: 14px;
	border-bottom: 1px solid #ed414a;
	width: 20%;
}
.Fl_swiper {
	width: 80%;
  overflow: hidden;
}
.swiper-container {
	width: 100%;
	height: 50px;
}

.swiper-slide {
  width: 100%;
	text-align: center;
	font-size: 14px;
	height: 50px;
	background: #fff;
	display: -webkit-box;
	display: -ms-flexbox;
	display: -webkit-flex;
	display: flex;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	-webkit-justify-content: center;
	justify-content: center;
	-webkit-box-align: center;
	-ms-flex-align: center;
	-webkit-align-items: center;
	align-items: center;
}
</style>
